/*
 * SPDX-License-Identifier:	GPL-2.0+
 */

/*
 * This file contains the configuration parameters for the ls1b_core board.
 */

#ifndef __CONFIG_LS1B_MB_V20_DOUBLE_MAC_H
#define __CONFIG_LS1B_MB_V20_DOUBLE_MAC_H

#include "ls1b_core.h"

#define CONFIG_BOARD_NAME	"ls1b lsgd1b20_bpd1_v10"
#define CONFIG_BOARD_LSGD1B20_BPD1_V10

/* UART */
#define CONFIG_CPU_UART
#define CONFIG_BAUDRATE			115200
#define CONFIG_CONS_INDEX	5

#define CONFIG_SYS_NS16550
#define CONFIG_SYS_NS16550_SERIAL
#define CONFIG_SYS_NS16550_REG_SIZE	 1
#define CONFIG_SYS_NS16550_CLK	0
#define CONFIG_SYS_NS16550_COM5	 0xbfe7c000
#define UART_BASE_ADDR	CONFIG_SYS_NS16550_COM5

#define	CONFIG_EXTRA_ENV_SETTINGS					\
	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
	"mtdids=" MTDIDS_DEFAULT "\0"					\
	"mtdparts=" MTDPARTS_DEFAULT "\0"				\
	"serverip=192.168.1.2\0" \
	"ipaddr=192.168.1.20\0" \
	"panel=" "hk070r21b01" "\0" \
	"menucmd=bootmenu\0" \
	"bootmenu_0=System Boot Linux from nand flash=setenv bootcmd 'nboot kernel;bootm ${loadaddr}';\
setenv bootargs " CONFIG_BOOTARGS ";saveenv\0" \
	"bootmenu_1=System Boot Rt-Thread from nand flash=setenv bootcmd 'nand read ${loadaddr} kernel 0x00200000;bootelf ${loadaddr}';\
setenv bootargs " CONFIG_BOOTARGS ";saveenv\0" \
	"bootmenu_2=Update Kernel(tftp to nand)=loongson_update tftp kernel nand\0" \
	"bootmenu_3=Update Rootfs(tftp to nand)=loongson_update tftp rootfs\0" \
	"bootmenu_4=Update U-Boot(tftp)=loongson_update tftp uboot\0" \
	"bootmenu_5=Update Kernel(usb to nand)=loongson_update usb kernel nand\0" \
	"bootmenu_6=Update Rootfs(usb to nand)=loongson_update usb rootfs\0" \
	"bootmenu_7=Update U-Boot(usb)=loongson_update usb uboot\0" \
	"bootmenu_8=Update All(usb)=loongson_update usb all nand\0" \
	"bootmenu_9=Update Rt-Thread(tftp to nand)=loongson_update tftp rtthread nand\0" \
	"bootmenu_10=Update Rt-Thread(usb  to nand)=loongson_update usb rtthread nand\0" \
	"bootmenu_delay=10\0" \

#define MTDIDS_DEFAULT          "nand0=ls1x-nand"
#define MTDPARTS_DEFAULT	"mtdparts=ls1x-nand:"	\
						"14M(kernel),"	\
						"-(root)"

/* Ethernet driver configuration */
#define CONFIG_MII
#define CONFIG_PHY_REALTEK
#define CONFIG_PHY_MOTORCOMM
#define CONFIG_PHYLIB
#define CONFIG_PHY_ADDR				0
#define CONFIG_LOONGSON_GMAC
#define CONFIG_DW_GMAC_DEFAULT_DMA_PBL	1
#define LOONGSON_GMAC0_EN
#define LOONGSON_GMAC1_EN
#define LOONGSON_GMAC_PHY_MODE PHY_INTERFACE_MODE_MII
#define LOONGSON_GMAC0_100M
#define LOONGSON_GMAC1_100M
#define CONFIG_NET_MULTI
#define CONFIG_HAS_ETH1

/* Framebuffer and LCD */
#define CONFIG_VIDEO
#define CONFIG_VIDEO_LS1X
#define CONFIG_LS1X_DC0
//#define CONFIG_LS1X_DC0_USE_DEMODE
//#define CONFIG_LS1X_DC1
//#define CONFIG_LS1X_DC1_USE_DEMODE
#define VIDEO_FB_16BPP_WORD_SWAP
#define CONFIG_SPLASH_SCREEN
#define CONFIG_SPLASH_SCREEN_ALIGN
#define CONFIG_CFB_CONSOLE
#define CONFIG_VGA_AS_SINGLE_DEVICE
#define CONFIG_SYS_CONSOLE_IS_IN_ENV
#define DEFAULT_FB_SIZE	SZ_4M
/*#define CONFIG_CONSOLE_MUX*/ /* 可以同时输出到lcd和串口的 */
#define CONFIG_VIDEO_LOGO
/*
#define CONFIG_VIDEO_BMP_RLE8
#define CONFIG_VIDEO_BMP_LOGO*/
#define CONFIG_BMP_16BPP
#define CONFIG_BMP_24BPP
#define CONFIG_BMP_32BPP
#define CONFIG_CMD_BMP
/* lcd背光或供电控制 /board/ls1x/ls1x_video.c文件中lcd控制器初始化后使能背光 */
//#define CONFIG_BACKLIGHT_GPIO 28	//gpio号

#define CONFIG_MENU
//#define CONFIG_MENUKEY 0 //0表示任意按键
#define CONFIG_CMD_BOOTMENU

#define CONFIG_AUTOBOOT_KEYED
#define CONFIG_AUTOBOOT_PROMPT "Press 'c' into Cmdline or 'm' into Menu\r\n"
#define CONFIG_AUTOBOOT_STOP_STR "c" /* 启动时按c进入命令行 */
#define CONFIG_AUTOBOOT_DELAY_STR "m" /* 启动时按m进入菜单栏 */
//#define CONFIG_BOOTCOMMAND	"tftpboot 0xa2000000 uImage\;bootm ${loadaddr}"	/* Autoboot command	*/
#define CONFIG_BOOTCOMMAND	"nboot kernel\;bootm ${loadaddr}" /* 注意： nboot默认加载地址为CONFIG_SYS_LOAD_ADDR，CONFIG_SYS_LOAD_ADDR要与bootm的地址一致 */
//#define CONFIG_BOOTARGS		"console=ttyS5,115200 root=/dev/mtdblock1 " MTDPARTS_DEFAULT " noinitrd rootfstype=squashfs video=ls1xfb:480x272-16@60"
//#define CONFIG_BOOTARGS		"console=ttyS5,115200 root=/dev/mtdblock1 " MTDPARTS_DEFAULT " noinitrd rootfstype=cramfs video=ls1xfb:480x272-16@60"
//#define CONFIG_BOOTARGS		"console=ttyS5,115200 root=/dev/mtdblock1 " MTDPARTS_DEFAULT " noinitrd rootfstype=yaffs2 rw video=ls1xfb:480x272-16@60"
//#define CONFIG_BOOTARGS		"console=ttyS5,115200 root=ubi0:rootfs ubi.mtd=1,2048 " MTDPARTS_DEFAULT " noinitrd rootfstype=ubifs rw video=ls1xfb:480x272-16@60"
#define CONFIG_BOOTARGS		"console=ttyS5,115200 root=ubi0:rootfs ubi.mtd=root,2048 " MTDPARTS_DEFAULT " noinitrd rootfstype=ubifs rw video=ls1xfb:1024x600-16@60"

/* I2C settings */
#define CONFIG_LS1X_I2C
#define CONFIG_HARD_I2C
#define CONFIG_SYS_I2C_SPEED		400000
#define CONFIG_SYS_I2C_SLAVE		0
#define CONFIG_CMD_I2C

/* i2c eeprom */
#define CONFIG_CMD_EEPROM
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x56
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
#define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW 0
#define CONFIG_SYS_I2C_MULTI_EEPROMS
#define CONFIG_SYS_EEPROM_SIZE 4096
#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5

/*
 * TCA6424A（使用pac953x驱动）配置，首先需要选择I2C控制器驱动
 */
#define CONFIG_PCA953X
#define CONFIG_CMD_PCA953X
#define CONFIG_CMD_PCA953X_INFO
#define CONFIG_SYS_I2C_PCA953X_ADDR	0x22
#define CONFIG_SYS_I2C_PCA953X_WIDTH	{ {0x22, 24} }

#define BEEP_GPIO 35

#define CONFIG_PWM_LOONGSON

#endif	/* __CONFIG_LS1B_MB_V20_DOUBLE_MAC_H */
